home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / cwscr.exe / MYMOU.H < prev    next >
Text File  |  1991-05-22  |  2KB  |  74 lines

  1. /*
  2.     Mouse module class specification.
  3.  
  4.     This is the header file that should be used when access to a
  5.     mouse pointing device is desired.
  6.  
  7.     Library : mycpp.lib
  8. */
  9.  
  10. #ifndef __MYMOU_H__
  11. #define __MYMOU_H__
  12.  
  13. static char MyMouh_Id[] = "mymou.h     1.10 05/22/91";
  14. /*
  15.     Version notes :
  16.         1.00 - Original creation / release. ( 2-13-91 CW )
  17.         1.10 - Added enumeration for button specifier. ( 5-22-91 CW )
  18. */
  19.  
  20.  
  21. /* ================================================================== */
  22.  
  23. typedef enum { LEFT_BUTTON, RIGHT_BUTTON, MIDDLE_BUTTON } ButtonType;
  24.  
  25. /* ------------------------------------------------------------------ */
  26. class myMouse {
  27.     int xp_pos, yp_pos;
  28.     int xr_pos, yr_pos;
  29.     int status;
  30.     int count;
  31.     int button_s;           // current button status.
  32.     int installed;
  33.  
  34.     int m1, m2, m3, m4;     // used for mouse parameters.
  35.  
  36.     void poll_mouse();
  37.  
  38. public:
  39.     myMouse(){
  40.         installed = status = 0;
  41.         m1 = m2 = m3 = m4 = 0;
  42.         poll_mouse();
  43.         if( m1 ){
  44.             installed = 1;
  45.             m1 = 10;    // set text cursor.
  46.             m2 = 0;     // specify software style.
  47.             m3 = 0x00FF;
  48.             m4 = 0x7100;
  49.             poll_mouse();
  50.         }
  51.     };
  52.     ~myMouse(){
  53.         if( installed && status )
  54.             hide();
  55.     };
  56.  
  57.     void show();
  58.     void hide();
  59.  
  60.     int pressed( ButtonType button );
  61.     int released( ButtonType button );
  62.  
  63.     int xpress(){ return( xp_pos ); };
  64.     int ypress(){ return( yp_pos ); };
  65.     int xrelease(){ return( xr_pos ); };
  66.     int yrelease(){ return( yr_pos ); };
  67.  
  68.     void xlimits( int low, int high );
  69.     void ylimits( int low, int high );
  70. };
  71.  
  72. #endif
  73.  
  74.